/* ***批量安装我的自定义组件********** */
import Vue from 'vue'
const ex = {
    install(Vue){
        G.import( require.context('.',false,/\.vue$/),(obj,path)=>{
            Vue.component( obj.name,obj );
        } );
    }
};
Vue.use(ex);

/* ***批量安装我的自定义指令********** */
forObj( {
    drag: { //元素窗口移动、双击全屏最大化 v-drag.0=' [ "parent_selector", "children_selectors" ] || ""children_selectors"" '
        bind(el,obj){
            var parent = null;
            for( parent in obj.modifiers ) {
                if ( parent >= 0 ) {
                    parent = el.children[parent];
                    if ( parent === undefined ) return;
                }else {
                    parent = el.querySelector(parent);
                    if ( parent === null ) return;
                };
                break;
            };
            const value = obj.value;
            const titleBar = typeof value === 'string' ? (parent||el).querySelectorAll(value) : ( parent = el.querySelector(value[0]), (parent||el).querySelectorAll(value[1]) );
            parent === null && ( parent = el );
            if ( titleBar.length === 0  ) return;
            // console.info(parent,titleBar);
            $.drag(parent,titleBar);
        }
    }
},(v,k)=>Vue.directive(k,v) );

// 导出组件
export default ex;